package wzc.design_pattern.behaviour.strategy;

/**
 * @Author 那和不是个啥
 * @Date 2025/7/20
 * @Description
 */

public class StrategyPatternDemo {
    public static void main(String[] args) {
        ShoppingCart cart = new ShoppingCart();

        // 用户选择信用卡支付
        cart.setPaymentStrategy(new CreditCardPayment("1234-5678-9876-5432"));
        cart.checkout(500);

        // 用户选择支付宝支付
        cart.setPaymentStrategy(new AlipayPayment("user@example.com"));
        cart.checkout(300);

        // 用户选择微信支付
        cart.setPaymentStrategy(new WeChatPayment("user123"));
        cart.checkout(150);
    }
}
